/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package prcEvent;

import io.demo.StoreInBinary;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author VANDH
 */
public class ManagerEvent {

    ArrayList<Event> eventList;

    public ManagerEvent() throws IOException {
        eventList = new ArrayList();
        // Open file “event.txt” and read all events into ArrayList
        try {
            BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream("Event.txt")));
            String line;

            while ((line = br.readLine()) != null) {
                String[] parts = line.split("-");
                // 1h30-cong vien tao dan-quang ba san pham XYZ
                // ["1h30", "cong vien tao dan", "quang ba san pham XYZ"]
                Event e = new Event(parts[0], parts[1], parts[2]);
                eventList.add(e);
            }
        } catch (FileNotFoundException ex) {
            Logger.getLogger(StoreInBinary.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
